Skip to content

131 implement redesigned dormitory details page and extend cms collection#171

Open
DankaMarci wants to merge 2 commits into
mainfrom
131-implement-redesigned-dormitory-details-page-and-extend-cms-collection
Open

131 implement redesigned dormitory details page and extend cms collection#171
DankaMarci wants to merge 2 commits into
mainfrom
131-implement-redesigned-dormitory-details-page-and-extend-cms-collection

Conversation

@DankaMarci

@DankaMarci DankaMarci commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features
    • Dormitory pages now load from CMS content and support Hungarian/English localization.
    • Dormitory listings now show CMS-driven cards, updated empty states, and cleaner image handling.
    • Individual dormitory pages can display localized descriptions, galleries, capacity, address, room info, target audience, map links, and external website buttons.
    • Added support for richer dormitory content management, including galleries and additional metadata.

@DankaMarci DankaMarci requested a review from peterlipt July 3, 2026 12:58
@DankaMarci DankaMarci self-assigned this Jul 3, 2026
@DankaMarci DankaMarci linked an issue Jul 3, 2026 that may be closed by this pull request
7 tasks
@vercel

vercel Bot commented Jul 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ehk Ready Ready Preview, Comment Jul 3, 2026 12:58pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR introduces a new "dormitories" Payload CMS collection with schema, migrations, and generated types, adds getDormitories()/getDormitoryBySlug() query helpers, and updates the dormitory list and detail pages to render CMS-driven, localized content. The ImageCard component is refactored with a new layout and detailsLabel prop, and dictionary files gain new label entries.

Changes

Dormitory CMS Feature

Layer / File(s) Summary
Dormitories collection schema
src/collections/Dormitories.ts
Adds a URL validation helper and defines the Dormitories collection config with admin metadata and a full fields schema covering text, uploads, rich text, and gallery fields.
Database migrations
src/migrations/20260703_140815_dormitories_collection.ts, src/migrations/20260703_143300_extend_dormitories_details.ts, src/migrations/index.ts
Adds migrations creating the dormitories table plus multilingual/gallery extensions with corresponding up/down functions, and registers both in the migrations index.
Generated types and config registration
src/payload-types.ts, src/payload.config.ts
Adds Dormitory/DormitoriesSelect types, extends Config and PayloadLockedDocument unions, and registers the collection in payload.config.ts.
CMS query helpers
src/lib/payload-cms.ts
Adds getDormitories() and getDormitoryBySlug() functions for fetching dormitory records.
ImageCard component refactor
src/components/common/ImageCard.tsx
Rebuilds the card layout with next/image, a detailsLabel prop, and conditional external anchor vs internal Link wrapping.
Dormitory list page
src/app/(app)/[lang]/kollegium/kollegium-bemutato/page.tsx, src/dictionaries/en/dormitories.json, src/dictionaries/hu/dormitories.json
Fetches dictionary and CMS data concurrently, builds ImageCard entries from valid cover images, renders a grid or empty state, and updates related label strings.
Dormitory detail page
src/app/(app)/[lang]/kollegium/kollegium-bemutato/[slug]/page.tsx
Fetches a dormitory by slug and renders localized description, gallery, and sidebar content, calling notFound() when the record is missing.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Page as DormitoryListPage
  participant Dict as getDictionary
  participant CMS as getDormitories
  participant Card as ImageCard
  Page->>Dict: fetch dormitories dictionary
  Page->>CMS: fetch dormitory records
  CMS-->>Page: dormitories with coverImage
  Page->>Page: build cards, filter invalid coverImage
  Page->>Card: render ImageCard per valid dormitory
Loading
sequenceDiagram
  participant Page as DormitoryDetailsPage
  participant CMS as getDormitoryBySlug
  participant NotFound as notFound
  participant UI as RichText/Gallery/Sidebar
  Page->>CMS: fetch dormitory by slug
  CMS-->>Page: dormitory record or undefined
  alt not found
    Page->>NotFound: trigger 404
  else found
    Page->>UI: render description, gallery, sidebar
  end
Loading

Suggested reviewers: peterlipt

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: redesigning the dormitory details page and extending the CMS collection.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 131-implement-redesigned-dormitory-details-page-and-extend-cms-collection

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@peterlipt

Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/migrations/20260703_140815_dormitories_collection.ts`:
- Line 9: The dormitories migration defines cover_image_id as NOT NULL while its
foreign key uses ON DELETE set null, which is incompatible. Update the foreign
key behavior in the migration that creates the cover_image_id relation to use ON
DELETE restrict, or alternatively make cover_image_id nullable if null-on-delete
is intended; use the cover_image_id column definition in
20260703_140815_dormitories_collection as the place to fix it.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8ce98fef-e1d9-4d43-8988-09e52971a970

📥 Commits

Reviewing files that changed from the base of the PR and between 2cbebd5 and 9713629.

📒 Files selected for processing (12)
  • src/app/(app)/[lang]/kollegium/kollegium-bemutato/[slug]/page.tsx
  • src/app/(app)/[lang]/kollegium/kollegium-bemutato/page.tsx
  • src/collections/Dormitories.ts
  • src/components/common/ImageCard.tsx
  • src/dictionaries/en/dormitories.json
  • src/dictionaries/hu/dormitories.json
  • src/lib/payload-cms.ts
  • src/migrations/20260703_140815_dormitories_collection.ts
  • src/migrations/20260703_143300_extend_dormitories_details.ts
  • src/migrations/index.ts
  • src/payload-types.ts
  • src/payload.config.ts

"id" serial PRIMARY KEY NOT NULL,
"name" varchar NOT NULL,
"slug" varchar NOT NULL,
"cover_image_id" integer NOT NULL,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the migration file
wc -l src/migrations/20260703_140815_dormitories_collection.ts
cat -n src/migrations/20260703_140815_dormitories_collection.ts | sed -n '1,220p'

# Find the collection schema and related references
rg -n "coverImage|cover_image_id|dormitories" src -g '!**/node_modules/**'

Repository: kir-dev/ehk

Length of output: 18275


🏁 Script executed:

#!/bin/bash
set -euo pipefail

wc -l src/collections/Dormitories.ts
cat -n src/collections/Dormitories.ts | sed -n '1,180p'

Repository: kir-dev/ehk

Length of output: 1945


cover_image_id can’t be SET NULL while remaining NOT NULL

ON DELETE set null on "cover_image_id" will fail whenever a referenced media row is deleted. Use ON DELETE restrict here, or make the column nullable if null-on-delete is intended.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/migrations/20260703_140815_dormitories_collection.ts` at line 9, The
dormitories migration defines cover_image_id as NOT NULL while its foreign key
uses ON DELETE set null, which is incompatible. Update the foreign key behavior
in the migration that creates the cover_image_id relation to use ON DELETE
restrict, or alternatively make cover_image_id nullable if null-on-delete is
intended; use the cover_image_id column definition in
20260703_140815_dormitories_collection as the place to fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Redesigned Dormitory Details Page and Extend CMS Collection

2 participants